Location: Acid-Base Physiology @ bb2ab4e8c78a / BG / New - Boron NH4Cl expts - original eqns--ro.cellml

Author:
Soroush Safaei <ssaf006@aucklanduni.ac.nz>
Date:
2018-01-11 17:25:06+13:00
Desc:
fixing cellml equations
Permanent Source URI:
https://models.cellml.org/workspace/297/rawfile/bb2ab4e8c78a4e0d03fb97a2f43d3de151c711a7/BG/New - Boron NH4Cl expts - original eqns--ro.cellml

<?xml version='1.0'?>
<model name="Boron_CO2_expts_original_eqns" xmlns="http://www.cellml.org/cellml/1.1#" xmlns:cellml="http://www.cellml.org/cellml/1.1#">
    <units name="per_s">
        <unit exponent="-1" units="second"/>
    </units>
    <units name="per_m">
        <unit exponent="-1" units="metre"/>
    </units>
    <units name="m_per_s">
        <unit units="metre"/>
        <unit exponent="-1" units="second"/>
    </units>
    <units name="mol_per_m3">
        <unit units="mole"/>
        <unit exponent="-3" units="metre"/>
    </units>
    <units name="mol_per_m2_s">
        <unit exponent="1" units="mole"/>
        <unit exponent="-2" units="metre"/>
        <unit exponent="-1" units="second"/>
    </units>
    <units name="mol_per_m3_s">
        <unit exponent="1" units="mole"/>
        <unit exponent="-3" units="metre"/>
        <unit exponent="-1" units="second"/>
    </units>
    <units name="J_per_C">
        <unit units="joule"/>
        <unit exponent="-1" units="coulomb"/>
    </units>
    <units name="C_per_mol">
        <unit units="coulomb"/>
        <unit exponent="-1" units="mole"/>
    </units>
    <units name="J_per_mol_K">
        <unit units="joule"/>
        <unit exponent="-1" units="mole"/>
        <unit exponent="-1" units="kelvin"/>
    </units>
    <units name="m3_per_mol">
        <unit exponent="3" units="metre"/>
        <unit exponent="-1" units="mole"/>
    </units>
    <component name="main">
        <!-- var u_E: J_per_C {init: -0.05, pub: out}; -->
        <variable initial_value="-0.055" name="V_m" public_interface="out" units="J_per_C"/>
        <!---55 mV in WFB code....for consistency with the code for the CO2 model, I would use V_m and not u_E-->
        <variable initial_value="0.0" name="TB_i" units="mol_per_m3"/>
        <variable name="NH3_i" units="mol_per_m3"/>
        <variable name="NH3_o" units="mol_per_m3"/>
        <variable name="NH4_i" units="mol_per_m3"/>
        <variable name="NH4_o" units="mol_per_m3"/>
        <variable name="TB_o" units="mol_per_m3"/>
        <!-- new variable for TB_o. This variable is needed for calculating the initial concentrations for NH4_o and NH3_o-->
        <variable initial_value="4.786300923226380e-05" name="H_i" units="mol_per_m3"/>
        <!--4.786300923226380e-05 corresponds to pHi = 7.32, value used by WFB in his code
var H_i_ref: mol_per_m3 {init: 1e-6}; -->
        <variable initial_value="3.981071705534970e-05" name="H_Lim" units="mol_per_m3"/>
        <!--for consistency with the code for the CO2 model, I am using H_Lim and not H_i_ref....also, since k = 0 for all NH3 simulations J_H doesn't affect the ode-->
        <variable initial_value="1.995262314968879e-05" name="H_o" units="mol_per_m3"/>
        <variable name="t" units="second"/>
        <variable name="pH_i" units="dimensionless"/>
        <variable name="pH_o" units="dimensionless"/>
        <variable name="pH_Lim" units="dimensionless"/>
        <!--RO added this variable-->
        <variable initial_value="8000" name="rho" units="per_m"/>
        <!--cell is cylindrical and not spherical, thus rho = 2/radius-->
        <variable name="epsilon" units="dimensionless"/>
        <variable name="alpha_i" units="dimensionless"/>
        <!--var alpha_o: dimensionless; there is no need for alpha_o-->
        <variable initial_value="6e-5" name="P_NH3" units="m_per_s"/>
        <!--P_NH3 is fixed-->
        <variable initial_value="1e-6" name="P_NH4" units="m_per_s"/>
        <!--P_NH4 varies: 0, 1e-8, 1e-7, 1e-6 m_per_s-->
        <variable initial_value="0" name="k" units="per_s"/>
        <!-- k is always zero. Also RO changed units here. RO & WFB would like to keep the units of k per_s to avoid confusion with permeability-->
        <variable initial_value="0.0256796" name="RTF" units="J_per_C"/>
        <variable initial_value="3.162277660168379e-07" name="K_B" units="mol_per_m3"/>
        <variable initial_value="-9" name="beta" units="mol_per_m3"/>
        <variable name="J_H" units="mol_per_m2_s"/>
        <!--RO says that if we define J_H in units of "per_m2" then we should explain in the text that J_H has already been divided by rho in the equation below...flux versus pseudoflux . -->
        <variable name="J_NH4" units="mol_per_m2_s"/>
        <variable name="J_NH3" units="mol_per_m2_s"/>
        <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
                <eq/>
                <ci>epsilon</ci>
                <apply>
                    <exp/>
                    <apply>
                        <divide/>
                        <ci>V_m</ci>
                        <ci>RTF</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>pH_i</ci>
                <apply>
                    <minus/>
                    <apply>
                        <log/>
                        <apply>
                            <times/>
                            <cn cellml:units="m3_per_mol" type="e-notation">1<sep/>-3</cn>
                            <ci>H_i</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>pH_o</ci>
                <apply>
                    <minus/>
                    <apply>
                        <log/>
                        <apply>
                            <times/>
                            <cn cellml:units="m3_per_mol" type="e-notation">1<sep/>-3</cn>
                            <ci>H_o</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>pH_Lim</ci>
                <apply>
                    <minus/>
                    <apply>
                        <log/>
                        <apply>
                            <times/>
                            <cn cellml:units="m3_per_mol" type="e-notation">1<sep/>-3</cn>
                            <ci>H_Lim</ci>
                        </apply>
                    </apply>
                </apply>
            </apply>
            <!--RO added this-->
            <!-- NH4_o = sel
   case t < 100{second}:
      0{mol_per_m3};
   case t < 700{second}:
      10{mol_per_m3};
   otherwise:
     0{mol_per_m3};
endsel;-->
            <!-- RO changed to TB_o....see below-->
            <!-- WFB may have used 9 mM for TB in his simulations and not 10 mM as stated in the legend of fig 6 of the ms :(.  -->
            <apply>
                <eq/>
                <ci>TB_o</ci>
                <piecewise>
                    <piece>
                        <cn cellml:units="mol_per_m3">0</cn>
                        <apply>
                            <lt/>
                            <ci>t</ci>
                            <cn cellml:units="second">100</cn>
                        </apply>
                    </piece>
                    <piece>
                        <cn cellml:units="mol_per_m3">9</cn>
                        <apply>
                            <lt/>
                            <ci>t</ci>
                            <cn cellml:units="second">1500</cn>
                        </apply>
                    </piece>
                    <otherwise>
                        <cn cellml:units="mol_per_m3">0</cn>
                    </otherwise>
                </piecewise>
            </apply>
            <!--alpha_o = H_o/(H_o+K_B); ....not correct :( 
 NH3_o = (1{dimensionless}-alpha_o)/alpha_o*NH4_o;...not correct :(-->
            <!--New by RO-->
            <apply>
                <eq/>
                <ci>NH4_o</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <ci>H_o</ci>
                        <ci>TB_o</ci>
                    </apply>
                    <apply>
                        <plus/>
                        <ci>H_o</ci>
                        <ci>K_B</ci>
                    </apply>
                </apply>
            </apply>
            <!--Based on the equilibrium in the bulk solution (outside the cell)-->
            <!--New by RO-->
            <apply>
                <eq/>
                <ci>NH3_o</ci>
                <apply>
                    <minus/>
                    <ci>TB_o</ci>
                    <ci>NH4_o</ci>
                </apply>
            </apply>
            <!--J_H = k*(H_i-H_Lim);
For consistency with the CO2 model, J_H is now defined aas below-->
            <apply>
                <eq/>
                <ci>J_H</ci>
                <piecewise>
                    <piece>
                        <apply>
                            <times/>
                            <ci>k</ci>
                            <apply>
                                <minus/>
                                <ci>H_i</ci>
                                <ci>H_Lim</ci>
                            </apply>
                        </apply>
                        <apply>
                            <lt/>
                            <ci>pH_i</ci>
                            <ci>pH_Lim</ci>
                        </apply>
                    </piece>
                    <otherwise>
                        <cn cellml:units="mol_per_m2_s">0</cn>
                    </otherwise>
                </piecewise>
            </apply>
            <apply>
                <eq/>
                <ci>J_NH3</ci>
                <apply>
                    <times/>
                    <ci>P_NH3</ci>
                    <apply>
                        <minus/>
                        <ci>NH3_o</ci>
                        <ci>NH3_i</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>J_NH4</ci>
                <apply>
                    <divide/>
                    <apply>
                        <times/>
                        <apply>
                            <divide/>
                            <apply>
                                <times/>
                                <ci>P_NH4</ci>
                                <ci>V_m</ci>
                            </apply>
                            <ci>RTF</ci>
                        </apply>
                        <apply>
                            <minus/>
                            <ci>NH4_o</ci>
                            <apply>
                                <times/>
                                <ci>NH4_i</ci>
                                <ci>epsilon</ci>
                            </apply>
                        </apply>
                    </apply>
                    <apply>
                        <minus/>
                        <ci>epsilon</ci>
                        <cn cellml:units="dimensionless">1</cn>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>TB_i</ci>
                </apply>
                <apply>
                    <times/>
                    <ci>rho</ci>
                    <apply>
                        <plus/>
                        <ci>J_NH3</ci>
                        <ci>J_NH4</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>alpha_i</ci>
                <apply>
                    <divide/>
                    <ci>H_i</ci>
                    <apply>
                        <plus/>
                        <ci>H_i</ci>
                        <ci>K_B</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <apply>
                    <diff/>
                    <bvar>
                        <ci>t</ci>
                    </bvar>
                    <ci>H_i</ci>
                </apply>
                <apply>
                    <times/>
                    <apply>
                        <divide/>
                        <apply>
                            <times/>
                            <apply>
                                <minus/>
                                <cn cellml:units="dimensionless">2.303</cn>
                            </apply>
                            <ci>H_i</ci>
                        </apply>
                        <ci>beta</ci>
                    </apply>
                    <ci>rho</ci>
                    <apply>
                        <minus/>
                        <apply>
                            <minus/>
                            <apply>
                                <times/>
                                <apply>
                                    <minus/>
                                    <cn cellml:units="dimensionless">1</cn>
                                    <ci>alpha_i</ci>
                                </apply>
                                <ci>J_NH4</ci>
                            </apply>
                            <apply>
                                <times/>
                                <ci>alpha_i</ci>
                                <ci>J_NH3</ci>
                            </apply>
                        </apply>
                        <ci>J_H</ci>
                    </apply>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>NH4_i</ci>
                <apply>
                    <times/>
                    <ci>alpha_i</ci>
                    <ci>TB_i</ci>
                </apply>
            </apply>
            <apply>
                <eq/>
                <ci>NH3_i</ci>
                <apply>
                    <times/>
                    <apply>
                        <minus/>
                        <cn cellml:units="dimensionless">1</cn>
                        <ci>alpha_i</ci>
                    </apply>
                    <ci>TB_i</ci>
                </apply>
            </apply>
        </math>
    </component>
</model>